Skip to content

Delete merge branch after merging release PR - #31

Merged
labkey-tchad merged 6 commits into
developfrom
fb_overwriteStaleMergeBranch
Nov 11, 2026
Merged

labkey-tchad merged 6 commits into
developfrom
fb_overwriteStaleMergeBranch

Conversation

@labkey-tchad

@labkey-tchad labkey-tchad commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Rationale

When PRs are merged, GitHub doesn't always delete the head branch (GitHub support has indicated that this is a known issue). A stale merge forward branch (e.g. fb_bot_merge_26.7) causes the next branch-release run for that release to fail with "Previous merge forward was not resolved."

Instead of working around stale branches in branch-release, merge-release now explicitly deletes the head branch after successfully merging and pushing. This also cleans up fast-forward branches and the final merge forward of a release, which a branch-release workaround would never touch. If GitHub has already deleted the branch, nothing is done. Other failures are reported as error annotations and don't fail the job since the merge itself succeeded. The squash merge path (SNAPSHOT version bump) is unchanged.

Deleting the head branch immediately after pushing the merge is safe: testing in labkey-tchad/testAutomation (PRs 54-63) showed the PR is still marked as merged, even when the merge and branch deletion are pushed atomically.

Note: this doesn't clean up stale branches that already exist; those need to be deleted manually.

Related Pull Requests

  • None

Changes

  • Delete the merge branch after successfully merging and pushing a release PR

Tasks

  • Claude Code Review
  • Manual Testing

@labkey-tchad labkey-tchad changed the title Overwrite stale merge forward branch Delete merge branch after merging release PR Nov 10, 2026
@labkey-tchad labkey-tchad self-assigned this Nov 10, 2026
GitHub doesn't always delete the head branch after a PR is merged. Stale merge
branches cause subsequent releases to fail. After a successful merge, wait for
GitHub to mark the PR as merged and delete the head branch if it still exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@labkey-tchad
labkey-tchad force-pushed the fb_overwriteStaleMergeBranch branch from 640d134 to 214fc41 Compare November 10, 2026 23:51
labkey-tchad and others added 4 commits November 10, 2026 16:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Testing showed GitHub marks a pushed PR as merged even when the head branch is
deleted immediately (or atomically with the merge push).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@labkey-tchad
labkey-tchad merged commit ce8e972 into develop Nov 11, 2026
4 checks passed
@labkey-tchad
labkey-tchad deleted the fb_overwriteStaleMergeBranch branch November 11, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants